package com.fayou.algorithm.fib;

public class PrintFib {
    public static void main(String[] args) {
        int a = 1;
        int b = 1;
        int c = 0;
        for (int i = 3; i < 20; i++) {
            c = a+b;
            a = b;
            b = c;

         //   System.out.println(c + "\t"   );
        }


        for (int i = 1; i <= 20; i++) {
            System.out.println(fib(i)+ "\t" );
        }
    }



    public static int fib(int x){
        if (x==1||x==2){
            return 1;
        }

        return fib(x-1)+fib(x-2);
    }


    private static void qkSort(int[] a,int start,int end){
        if (a==null||a.length==0){
            return ;
        }
        if (start>end){
            return ;
        }
        int left = start;
        int right = end;
        int temp = a[left];
        while (left<right){
            while (left<right&&a[right]>temp){
                right--;
            }

            a[left] = a[right];


            while (left<right&&a[left]<temp){
                left++;
            }

            a[right] = a[left];

        }

        a[left]=temp;

        qkSort(a,start,left-1);
        qkSort(a,left+1,end);
    }
}
